package androidchat.com.view;
import java.util.ArrayList;
import java.util.List;

import com.androidchat.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import androidchat.com.common.GroupEntity;

public class GroupAdapter extends BaseAdapter{
	private Context context;
	private List<GroupEntity> list;
	
	LayoutInflater inflater;
   
	public GroupAdapter(Context context,List<GroupEntity> list){
		this.context = context;
		this.list = list;
		inflater = LayoutInflater.from(context);
	}


	public View getView(int position, View convertView, ViewGroup root) {
		convertView = inflater.inflate(R.layout.list_item, null);
		
		ImageView avatar=(ImageView) convertView.findViewById(R.id.ig);
		TextView nick=(TextView) convertView.findViewById(R.id.nick);
		TextView trends=(TextView) convertView.findViewById(R.id.descripetion);
	
		
		GroupEntity be=list.get(position);
	
	 
	    nick.setText(be.getGnick());
	   
		avatar.setImageResource(R.drawable.group_avatar);
	
		trends.setText(be.getGdes());
	    
		return convertView;
	    
	}
	public int getCount() {
		int b=0;
		if(list!=null)
		  b=list.size();
		else b=0;
		return b;
		
	}

	public Object getItem(int position) {
		return list.get(position);
	}

	public long getItemId(int position) {
		return position;
	}
}
